var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/functionalComponent/antd/message.tsx
var message_exports = {};
__export(message_exports, {
  message: () => message,
  notification: () => notification,
  usingProgress: () => usingProgress
});
module.exports = __toCommonJS(message_exports);
var import_antd = require("antd");
var import_util = require("../../util");
import_antd.message.config({
  maxCount: 6
});
var message = new Proxy({}, {
  get(_, p) {
    if (p === "progress") {
      return (options = {}) => {
        const { title = "loading...", animation = false, autoClose = false, afterClose, duration = 2 } = options;
        const cfg = {
          title,
          width: 260,
          zIndex: 2e3,
          styles: { body: { margin: "-15px -15px -20px" } },
          content: /* @__PURE__ */ React.createElement(
            import_util.ProgressLoading,
            {
              style: {
                marginLeft: -35,
                marginTop: 15
              },
              duration
            }
          ),
          okButtonProps: { style: { display: "none" } },
          afterClose
        };
        if (!animation) {
          cfg.transitionName = "";
          cfg.maskTransitionName = "";
        }
        let modal = (0, import_util.getAntApp)().modal.info(cfg);
        let destroy = () => {
          modal == null ? void 0 : modal.destroy();
          modal = null;
        };
        if (autoClose) {
          setTimeout(destroy, duration * 1e3);
        }
        return destroy;
      };
    }
    if (p === "warn") {
      return (0, import_util.getAntApp)().message.warning;
    }
    return (0, import_util.getAntApp)().message[p];
  }
});
import_util.iup.registerExternal({ message });
async function usingProgress(asyncFn, options) {
  const closeProgress = message.progress(options);
  try {
    return await asyncFn();
  } catch (e) {
    console.log(e);
    return {};
  } finally {
    closeProgress();
  }
}
var notification = new Proxy({}, {
  get(_, p) {
    return (0, import_util.getAntApp)().notification[p];
  }
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  message,
  notification,
  usingProgress
});
